home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / zm16src / phone.c < prev    next >
C/C++ Source or Header  |  1988-05-18  |  15KB  |  874 lines

  1. /*
  2.  * Phone dialing Module (from XMDM)
  3.  *
  4.  *
  5.  *        Jwahar Bammi
  6.  *            usenet: mandrill!bammi@{decvax,sun}.UUCP
  7.  *            csnet:  bammi@mandrill.ces.CWRU.edu
  8.  *            arpa:   bammi@mandrill.ces.CWRU.edu
  9.  *            CompuServe: 71515,155
  10.  */
  11.  
  12. #include "config.h"
  13.  
  14. #ifndef STANDALONE
  15. #ifdef PHONES
  16.  
  17. #include "zmdm.h"
  18.  
  19. typedef int WORD;
  20. typedef long LONG;
  21.  
  22.  
  23. #define sendchar(c)    Bconout(1, c);
  24. #define clear_screen()  Bconws("\033H\033J")
  25. #define inv()        EscSeq('p')
  26. #define normal()    EscSeq('q')
  27. #define mvto(r,c)    EscSeq('Y');Bconout(2, r+040);Bconout(2, c+040)
  28. #define ceol()        EscSeq('K')
  29. #define show_cursor()    EscSeq('e')
  30. #define hide_cursor()    EscSeq('f')
  31.  
  32. typedef struct _dir {        /* The Directory type */
  33.     char    *name;        /* Name (11 chars max) */
  34.     char     *number;    /* Phone # (24 chars max) */
  35.     WORD    baud;        /* baud Rate         */
  36.     struct _dir *next;    /* Ptr to next entry */
  37. } *DIR;
  38.  
  39.  
  40.      /* External Variables */
  41. extern WORD speed;        /* Current Baud Rate */
  42. extern WORD Baudrate;
  43. extern BAUDS vbauds[];
  44.  
  45. WORD dchanged = 0;            /* Has the directory been updated */
  46.  
  47.      /* Globals */
  48. static WORD ndir = 0;            /* # of entries in phone directory   */
  49. static DIR directory = (DIR)NULL;    /* The phone directory           */
  50. static DIR lastdir   = (DIR)NULL;     /* Pointer to last entry         */
  51. static char *dirfile = (char *)NULL;    /* Name of file conatining directory */
  52. static WORD rflag = 0;            /* Read directory as yet??          */
  53.  
  54.  
  55. /*
  56.  * Read the Telephone directory
  57.  *  returns -2 on read error
  58.  *        -1 if cancelled
  59.  *        -3 if file not found
  60.  *         n # of entries  otherwise
  61.  */
  62. WORD readdir()
  63. {
  64.     register char *filename;
  65.     register WORD handle;
  66.     register WORD nentries;
  67.     register DIR last;
  68.     register DIR present;
  69.     extern char *preadl();
  70.     extern char *malloc();
  71.     
  72.     Bconws("Enter Filename of Phone Directory or <CR> to Cancel: ");
  73.  
  74.     if((filename = preadl()) == (char *)NULL)
  75.         /* Cancelled */
  76.         return -1;
  77.  
  78.     if((dirfile = malloc(strlen(filename)+1)) == (char *)NULL)
  79.     {
  80.         /* Out of memory */
  81.         Bconws("Out of Memory\r\n");
  82.         return 0;
  83.     }
  84.     strcpy(dirfile,filename);
  85.     
  86.  
  87.     if((handle = Fopen(filename,0)) < 0)
  88.         /* File does not exist */
  89.         return -3;
  90.     
  91.     /* Read in the file */
  92.     if(Fread(handle, 2L, &ndir) != 2L)
  93.     {
  94.         Bconws("Error Reading ");
  95.         Bconws(filename);
  96.         Bconws("\r\n");
  97.         Fclose(handle);
  98.         return -2;
  99.     }
  100.  
  101.     /* Read in the directory */
  102.     last = (DIR)NULL;
  103.     directory = (DIR)NULL;
  104.     lastdir = (DIR)NULL;
  105.     rflag = 1;
  106.     
  107.     for(nentries = 0; nentries < ndir; nentries++)
  108.     {
  109.         /* Allocate an entry */
  110.         if((present = (DIR)malloc(sizeof(struct _dir))) == (DIR)NULL)
  111.         {
  112.             /* Out of memory */
  113.             Bconws("Out of Memory\r\n");
  114.             Fclose(handle);
  115.             return nentries;
  116.         }
  117.         
  118.         if((present->name = malloc(12)) == (char *)NULL)
  119.         {
  120.             /* Out of memory */
  121.             Bconws("Out of Memory\r\n");
  122.             Fclose(handle);
  123.             return nentries;
  124.         }
  125.  
  126.         if((present->number = malloc(25)) == (char *)NULL)
  127.         {
  128.             /* Out of memory */
  129.             Bconws("Out of Memory\r\n");
  130.             Fclose(handle);
  131.             return nentries;
  132.         }
  133.  
  134.         present->next = (DIR)NULL;
  135.         
  136.         /* Read in the entry */
  137.         if(Fread(handle,11L,present->name) != 11L)
  138.         {
  139.             Bconws("Error Reading ");
  140.             Bconws(filename);
  141.             Bconws("\r\n");
  142.             Fclose(handle);
  143.             rflag = 0;
  144.             freedir(directory);
  145.             return -2;
  146.  
  147.         }
  148.  
  149.         if(Fread(handle,24L,present->number) != 24L)
  150.         {
  151.             Bconws("Error Reading ");
  152.             Bconws(filename);
  153.             Bconws("\r\n");
  154.             Fclose(handle);
  155.             rflag = 0;
  156.             freedir(directory);
  157.             return -2;
  158.         }
  159.  
  160.         if(Fread(handle,2L,&(present->baud)) != 2L)
  161.         {
  162.             Bconws("Error Reading ");
  163.             Bconws(filename);
  164.             Bconws("\r\n");
  165.             Fclose(handle);
  166.             rflag = 0;
  167.             freedir(directory);
  168.             return -2;
  169.         }
  170.         
  171.  
  172.         present->name[11] = '\0';
  173.         present->number[24] = '\0';
  174.  
  175.         /* Link it on with the directory */
  176.         if(last == (DIR)NULL)
  177.             /* first entry */
  178.             directory = present;
  179.         else
  180.             last->next = present;
  181.         
  182.         last = present;
  183.     }
  184.     lastdir = last;
  185.     
  186.     return nentries;    
  187. }
  188.  
  189. /*
  190.  * Free space allocated to a phone directory
  191.  *
  192.  */
  193. freedir(dir)
  194. register DIR dir;
  195. {
  196.     register DIR next;
  197.     register DIR present;
  198.  
  199.     for(present = dir; present != (DIR)NULL; present = next)
  200.     {
  201.         next = present->next;
  202.         free(present->name);
  203.         free(present->number);
  204.         free(present);
  205.     }
  206.     
  207.     if(dirfile != (char *)NULL)
  208.     {
  209.         free(dirfile);
  210.         dirfile   = (char *)NULL;
  211.     }
  212.     
  213.     directory = (DIR)NULL;
  214.     lastdir      = (DIR)NULL;
  215.     ndir      = 0;
  216.     rflag      = 0;
  217. }
  218.  
  219. /*
  220.  * Write out the phone directory
  221.  *  -returns 0 on success 1 otherwise
  222.  *
  223.  */
  224. WORD writedir()
  225. {
  226.     register DIR dir;
  227.     register WORD fd;
  228.     
  229.     if((rflag == 0) || (dirfile == (char *)NULL) || (dchanged == 0))
  230.         /* Nothing to Save */
  231.         return 0;
  232.  
  233.     /* Create/Open file for write - overwrite if it exists */
  234.     if ((fd = Fcreate(dirfile,0)) < 0) /* Will fail if file is present */
  235.     {
  236.         /* Overwrite existing file */
  237.         if((fd = Fopen(dirfile,1)) < 0)
  238.         {
  239.             Bconws("Cannot Open ");
  240.             Bconws(dirfile);
  241.             Bconws("\r\n");
  242.             return 1;
  243.         }
  244.     }
  245.  
  246.     if(Fwrite(fd,2L,&ndir) != 2L)
  247.     {
  248.         Bconws("Error Writing ");
  249.         Bconws(dirfile);
  250.         Bconws("\r\n");
  251.         Fclose(fd);
  252.         return 1;
  253.     }
  254.     
  255.     for(dir = directory; dir != (DIR)NULL; dir = dir->next)
  256.     {
  257.         if(Fwrite(fd,11L,dir->name) != 11L)
  258.         {
  259.             Bconws("Error Writing ");
  260.             Bconws(dirfile);
  261.             Bconws("\r\n");
  262.             Fclose(fd);
  263.             return 1;
  264.         }
  265.  
  266.         if(Fwrite(fd,24L,dir->number) != 24L)
  267.         {
  268.             Bconws("Error Writing ");
  269.             Bconws(dirfile);
  270.             Bconws("\r\n");
  271.             Fclose(fd);
  272.             return 1;
  273.         }
  274.  
  275.         if(Fwrite(fd,2L,&(dir->baud)) != 2L)
  276.         {
  277.             Bconws("Error Writing ");
  278.             Bconws(dirfile);
  279.             Bconws("\r\n");
  280.             Fclose(fd);
  281.             return 1;
  282.         }
  283.     }
  284.     
  285.     Fclose(fd);
  286.     return 0;
  287. }
  288.  
  289. /*
  290.  * Show the phone directory
  291.  * return the entry # or -1 if cancelled
  292.  *
  293.  */
  294. WORD showdir()
  295. {
  296.     register WORD first, last;
  297.     register WORD n;
  298.     register char *line;
  299.     extern WORD atoi();
  300.     extern char *preadl();
  301.     
  302.     first = 0;
  303.  
  304.     while(1)
  305.     {
  306.         again:
  307.         clear_screen();
  308.  
  309.         mvto(0,19);
  310.         Bconws("Phone Directory: ");
  311.         Bconws(dirfile);
  312.         Bconws("  ");
  313.         printf("%d",ndir); fflush(stdout);
  314.         Bconws(" Entry(s)");
  315.  
  316.         last = (ndir < (first + 44)) ? ndir : first + 44;
  317.         putdir(first,last);
  318.         
  319.         /* mvto(25,0); */
  320.         Bconws("\r\n");
  321.         inv();
  322.         Bconws("Enter a # or <SPACE><RETURN> for Next Page or <RETURN> to Cancel:");
  323.         normal();
  324.         Bconout(2, ' ');
  325.         if((line = preadl()) == (char *)NULL)
  326.         {
  327.             return -1;
  328.         }
  329.         
  330.         if(isdigit(*line))
  331.         {
  332.             if((n = atoi(line)) >= ndir)
  333.             {
  334.                 Bconws("Invalid Number ");
  335.                 hit_key();
  336.                 goto again;
  337.             }
  338.             
  339.             return n;
  340.         }
  341.  
  342.         if(last == ndir)
  343.             first = 0;
  344.         else
  345.             first += 44;
  346.     }
  347. }
  348.  
  349. /*
  350.  * Put up directory entries on the screen
  351.  *
  352.  */
  353. putdir(first,last)
  354. register WORD first;
  355. register WORD last;
  356. {
  357.     register DIR dir;
  358.     register WORD row;
  359.     extern DIR nth();
  360.     
  361.     /* Find the first entry */
  362.     dir = nth(first);
  363.     row = (first % 44) + 1;
  364.  
  365.     hide_cursor();
  366.     inv();
  367.     for(; first < last; first++)
  368.     {
  369.         mvto(row,((first & 1)?41:0));
  370.         if(first < 10)
  371.             Bconout(2, ' ');
  372.         printf("%d",first); fflush(stdout);
  373.         Bconout(2, '|');
  374.         putstr(dir->name,11);
  375.         Bconout(2, '|');
  376.         putstr(dir->number,24);
  377.         dir = dir->next;
  378.         if(first & 1)
  379.             row++;
  380.     }
  381.  
  382.     if(first & 1)
  383.     {
  384.         mvto(row,41);
  385.         Bconws("  |           |                        ");
  386.         row++;
  387.     }
  388.  
  389.     for(; row < 23; row++)
  390.     {
  391.         Bconws("  |           |                        ");
  392.         mvto(row,41);
  393.         Bconws("  |           |                        ");
  394.     }
  395.  
  396.     normal();
  397.     show_cursor();
  398. }
  399.  
  400. /*
  401.  * Put a string padding to len on screen
  402.  */
  403. putstr(s,l)
  404. register char *s;
  405. register WORD l;
  406. {
  407.     register WORD pad;
  408.  
  409.     Bconws(s);
  410.     if((pad = l - strlen(s)) <= 0)
  411.         return;
  412.     for(; pad > 0; pad--)
  413.         Bconout(2, ' ');
  414. }
  415.  
  416.  
  417. /*
  418.  * Return the nth entry in the phone directory
  419.  *
  420.  */
  421. DIR nth(n)
  422. register WORD n;
  423. {
  424.     register WORD i;
  425.     register DIR dir;
  426.     
  427.     for(i = 0, dir = directory; (dir != (DIR)NULL) & (i < n);
  428.         i++, dir = dir->next)
  429.         /* Skip */;
  430.     return(dir);
  431. }
  432.  
  433. /*
  434.  * Add a entry in the phonebook
  435.  */
  436. addir()
  437. {
  438.     register DIR dir;
  439.     register char *s;
  440.     extern char *malloc(), *preadl();
  441.     
  442.     /* If a directory file already exists add, else read or create */
  443.     if(rflag == 0)
  444.     {
  445.         switch(readdir())
  446.         {
  447.             case -3:
  448.             /* Doesnt exist, but we will create it when we
  449.                write out the directory */
  450.             rflag = 1;
  451.             break;
  452.             
  453.             case 0:
  454.             case -2:
  455.             case -1:
  456.             hit_key();
  457.             return;
  458.             
  459.             default:
  460.             rflag = 1;
  461.             break;
  462.         }
  463.     }
  464.     
  465.     /* Allocate space for the new entry */
  466.     if((dir = (DIR)malloc(sizeof(struct _dir))) == (DIR)NULL)
  467.     {
  468.         Bconws("Out of Memory\r\n");
  469.         hit_key();
  470.         return;
  471.     }
  472.     
  473.     if((dir->name = malloc(12)) == (char *)NULL)
  474.     {
  475.         /* Out of memory */
  476.         Bconws("Out of Memory\r\n");
  477.         hit_key();
  478.         return;
  479.     }
  480.  
  481.     if((dir->number = malloc(25)) == (char *)NULL)
  482.     {
  483.         /* Out of memory */
  484.         Bconws("Out of Memory\r\n");
  485.         hit_key();
  486.         return;
  487.     }
  488.  
  489.         
  490.     /* Get the entry */
  491.     
  492.     do {
  493.         Bconws("Name: ");
  494.         s = preadl();
  495.     } while(s == (char *)NULL);
  496.     
  497.     strncpy(dir->name,s,11);
  498.     
  499.     do {
  500.         Bconws("Number: ");
  501.         s = preadl();
  502.     } while(s == (char *)NULL);
  503.     
  504.     strncpy(dir->number,s,24);
  505.     
  506.     do {
  507.         Bconws("Baud Rate: ");
  508.         s = preadl();
  509.     } while((s == (char *)NULL) || ((dir->baud = tobaud(s)) == -1));
  510.     
  511.     dir->next = (DIR)NULL;
  512.     
  513.     if(directory == (DIR)NULL)
  514.         directory = dir;
  515.     else
  516.         lastdir->next = dir;
  517.  
  518.     lastdir = dir;
  519.     dchanged = 1;
  520.     ndir++;
  521. }
  522.  
  523.  
  524.  
  525. /*
  526.  * Convert a string to a baud rate
  527.  * return int or -1 if invalid
  528.  */
  529. WORD tobaud(s)
  530. register char *s;
  531. {
  532.     register WORD i;
  533.     
  534.     for(i = 0; vbauds[i].sbaud != (char *)NULL; i++)
  535.     {
  536.         if(strcmp(vbauds[i].sbaud,s) == 0)
  537.             return vbauds[i].ibaud;
  538.     }
  539.  
  540.     Bconws(s);
  541.     Bconws(": Invalid Baud Rate\r\nValid Baud Rates are:\r\n");
  542.     for(i = 0; vbauds[i].sbaud != (char *)NULL; i++)
  543.     {
  544.         Bconout(2, '\t');
  545.         if((i != 0) && (vbauds[i].ibaud != vbauds[i-1].ibaud))
  546.         {
  547.             Bconws(vbauds[i].sbaud);
  548.             Bconws("\r\n");
  549.         }
  550.     }
  551.         
  552.     return -1;
  553. }
  554.  
  555. /*
  556.  * Dial a number 
  557.  */
  558. dial()
  559. {
  560.     register WORD n;
  561.     register DIR dir;
  562.     extern DIR nth();
  563.     
  564.     /* Has the directory been read so far */
  565.     if(rflag == 0)
  566.     {
  567.         /* Go read it */
  568.         switch(readdir())
  569.         {
  570.             case -1:
  571.             case -2:
  572.             case -3:
  573.             case 0:
  574.             rflag = 0;
  575.             hit_key();
  576.             his_screen();
  577.             return;
  578.             default:
  579.             break;
  580.         }
  581.     }
  582.     
  583.     if((n = showdir()) == -1)
  584.     {
  585.         /* Cancelled */
  586.         hit_key();
  587.         his_screen();
  588.         return;
  589.     }
  590.     
  591.     his_screen();
  592.     dir = nth(n);
  593.     if(dir->baud != speed)
  594.     {
  595.         speed = dir->baud;
  596.         Baudrate = jbaud(speed);
  597.         Rsconf(speed, -1, -1, -1, -1, -1);
  598.         sendchar('\r');
  599.         flushinput();
  600.     }
  601.     write_modem(PREDIAL, strlen(PREDIAL));
  602.     write_modem(dir->number,strlen(dir->number));
  603.     sendchar('\r');
  604. }
  605.  
  606.  
  607. /*
  608.  * Re-dial the previous number
  609.  *
  610.  *    Does it cheaply, by sending the modem its Re-dial
  611.  *    sequence, instead of remembering the last number dialed etc.
  612.  *
  613.  */
  614. redial()
  615. {
  616.     his_screen();
  617.     write_modem(REDIAL ,strlen(REDIAL));
  618. }
  619.  
  620.  
  621. /*
  622.  * Open a phone directory 
  623.  *
  624.  */
  625. opendir()
  626. {
  627.     /* if one is open, save it if changed, then deallocate memory
  628.       * and then open a new directory
  629.      */
  630.     if(rflag)
  631.     {
  632.         if(dchanged)
  633.         {
  634.             if(writedir() == 1)
  635.             {
  636.                 hit_key();
  637.                 return;
  638.             }
  639.             dchanged = 0;
  640.         }
  641.         freedir(directory);
  642.     }
  643.     
  644.     if(readdir() <= 0)
  645.     {
  646.         hit_key();
  647.         return;
  648.     }
  649. }
  650.  
  651. /*
  652.  * Delete an entry.
  653.  */
  654. delentry()
  655. {
  656.     register DIR dir, del;
  657.     register WORD n;
  658.     extern DIR nth();
  659.     
  660.     if(rflag == 0)
  661.     {
  662.         Bconws("Nothing to delete\r\n");
  663.         hit_key();
  664.         return;
  665.     }
  666.     
  667.     if((n = showdir()) == -1)
  668.     {
  669.         /* Cancelled */
  670.         hit_key();
  671.         return;
  672.     }
  673.     
  674.     if(ndir == 1)
  675.     {
  676.         del = directory;
  677.         directory = (DIR)NULL;
  678.         lastdir = (DIR)NULL;
  679.     }
  680.     else
  681.     {
  682.         if(n == 0)
  683.         {
  684.             del = directory;
  685.             dir = directory->next;
  686.             directory = dir;
  687.         }
  688.         else
  689.         {
  690.             dir = nth(n-1);
  691.             del = dir->next;
  692.             dir->next = del->next;
  693.             if(lastdir == del)
  694.                 lastdir = dir;
  695.         }
  696.     }
  697.     
  698.     free(del->name);
  699.     free(del->number);
  700.     free(del);
  701.     ndir--;
  702.     dchanged = 1;
  703.     
  704. }
  705.  
  706.     
  707. /*
  708.  * Phone services - top level
  709.  *
  710.  */
  711. phone()
  712. {
  713.     register LONG conin;
  714.     
  715.     while(1)
  716.     {
  717.         clear_screen();
  718.         mvto(2,32);
  719.         inv();
  720.         Bconws("Phone  Services");
  721.         normal();
  722.  
  723.         mvto(5,0);
  724.         
  725.         if(rflag)
  726.         {
  727.             Bconws("\tThe Phone Directory \"");
  728.             Bconws(dirfile);
  729.             Bconws("\" containing ");
  730.             printf("%d", ndir); fflush(stdout);
  731.             Bconws(" Entry(s) is Currently Open.\r\n\n");
  732.         }
  733.         else
  734.             Bconws("\tNo Phone Directory is Currently Open.\r\n\n");
  735.         
  736.         
  737.         /* Put up menu */
  738.         Bconws("\r\n\t");
  739.         EscSeq('p');        /* reverse video */
  740.         Bconws("Undo");
  741.         EscSeq('q');        /* quit reverse video */
  742.         Bconws(" to exit the emulator.\r\n");
  743.         
  744.         Bconws("\t");
  745.         EscSeq('p');        /* reverse video */
  746.         Bconws("d");
  747.         EscSeq('q');        /* quit reverse video */
  748.         Bconws(" to dial a number.\r\n");
  749.         
  750.         Bconws("\t");
  751.         EscSeq('p');        /* reverse video */
  752.         Bconws("a");
  753.         EscSeq('q');        /* quit reverse video */
  754.         Bconws(" to add an entry to the phone directory.\r\n");
  755.         
  756.         Bconws("\t");
  757.         EscSeq('p');        /* reverse video */
  758.         Bconws("D");
  759.         EscSeq('q');        /* quit reverse video */
  760.         Bconws(" to delete an entry from the phone directory.\r\n");
  761.         
  762.         Bconws("\t");
  763.         EscSeq('p');        /* reverse video */
  764.         Bconws("o");
  765.         EscSeq('q');        /* quit reverse video */
  766.         Bconws(" to open another phone directory.\r\n");
  767.  
  768.         Bconws("\t");
  769.         EscSeq('p');        /* reverse video */
  770.         Bconws("r");
  771.         EscSeq('q');        /* quit reverse video */
  772.         Bconws(" to re-dial last number.\r\n");
  773.         
  774.         Bconws("\t");
  775.         EscSeq('p');        /* reverse video */
  776.         Bconws("Return");
  777.         EscSeq('q');        /* quit reverse video */
  778.         Bconws(" to return to the emulator.\r\n\n\n\n");
  779.         
  780.         /* get response */
  781.         conin = Bconin(2);
  782.         
  783.         if ((conin & 0x00FF0000L) == 0x610000L)
  784.         {
  785.             /* He hit <UNDO> */
  786.             his_screen();
  787.             ResetIoBuf();
  788.             finish();
  789.         }
  790.         
  791.         switch((WORD)(conin & 0x7f))
  792.         {
  793.             case 'd':
  794.             /* Dial a number */
  795.             dial();
  796.             return;
  797.             
  798.             case 'D':
  799.             /* Delete an entry */
  800.             delentry();
  801.             break;
  802.             
  803.             case 'a':
  804.             /* Add an entry */
  805.             addir();
  806.             break;
  807.             
  808.             case 'o':
  809.             /* Open another phone directory */
  810.             opendir();
  811.             break;
  812.             
  813.  
  814.             case 'r':
  815.             /* Re-Dial # */
  816.             redial();
  817.             return;
  818.             
  819.             case '\r':
  820.             his_screen();
  821.             return;
  822.             
  823.             default:
  824.             break;
  825.         }
  826.         
  827.     }
  828.     
  829. }
  830.  
  831. /*
  832.  * Convert a baud rate to its int
  833.  * return int or -1 if invalid
  834.  */
  835. WORD jbaud(bd)
  836. register WORD bd;
  837. {
  838.     register WORD i;
  839.     
  840.     for(i = 0; vbauds[i].sbaud != (char *)NULL; i++)
  841.     {
  842.         if(vbauds[i].ibaud == bd)
  843.             return vbauds[i].jbaud;
  844.     }
  845.     return -1;
  846. }
  847.  
  848. static char scrth[80];
  849. /*
  850.  * Read a line from Standard Input and return a 
  851.  * NULL terminated pointer to it
  852.  */
  853. char *preadl()
  854. {
  855.     /* Use the scrth bufr for storage */
  856.     scrth[0] = 80;
  857.     Cconrs(scrth);
  858.     Bconws("\r\n");
  859.     if(scrth[1] == 0)
  860.     {
  861.         /* User Cancelled */
  862.         Bconws("Cancelled\r\n");
  863.         return((char *)NULL);
  864.     }
  865.     /* Terminate string that starts at scrth[2] */
  866.     scrth[scrth[1]+2] = '\0';
  867.     return(&scrth[2]);
  868. }    
  869.  
  870. #endif /* PHONES */
  871. #endif /* STANDALONE */
  872.  
  873. /* -eof - */
  874.